testsuite: Improve coverage for GtkMultiFilter
authorMatthias Clasen <mclasen@redhat.com>
Sat, 31 Oct 2020 02:27:15 +0000 (22:27 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 31 Oct 2020 02:27:40 +0000 (22:27 -0400)
testsuite/gtk/filter.c

index 2ddd0f3ebc090720f87c200f67be977c128f14b2..d6fb3fdb0e4adfb1a96ab53f85d4f388a6f1a885 100644 (file)
@@ -219,6 +219,7 @@ test_any_simple (void)
 {
   GtkFilterListModel *model;
   GtkFilter *any, *filter1, *filter2;
+  gpointer item;
 
   any = GTK_FILTER (gtk_any_filter_new ());
   filter1 = GTK_FILTER (gtk_custom_filter_new (divisible_by, GUINT_TO_POINTER (3), NULL));
@@ -233,6 +234,12 @@ test_any_simple (void)
   gtk_multi_filter_append (GTK_MULTI_FILTER (any), filter2);
   assert_model (model, "3 5 6 9 10 12 15 18 20");
 
+  g_assert_true (g_list_model_get_item_type (G_LIST_MODEL (any)) == GTK_TYPE_FILTER);
+  g_assert_cmpuint (2, ==, g_list_model_get_n_items (G_LIST_MODEL (any)));
+  item = g_list_model_get_item (G_LIST_MODEL (any), 1);
+  g_assert_true (GTK_FILTER (item) == filter2);
+  g_object_unref (item);
+
   gtk_multi_filter_remove (GTK_MULTI_FILTER (any), 0);
   assert_model (model, "5 10 15 20");